<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
<head>
<title>页面</title>
<style type="text/css">
/*top*/
body{margin:0 auto;padding:0 auto;text-align: center;width:980px;}

span{font-size:13px;}

table{border:1px dashed white;background: white;}

td{border: 1px dashed gray;}

ul, li { list-style:none;}

a{ color:#333; text-decoration:none;}

a:hover{ color:#F00; text-decoration:underline;}

a:active{ color:#30F;}

.nav {margin-top: -10px;margin-left: 50px;}/*////////////////////////////////////////////////*/

.nav ul li { float:left;}

.nav ul li a { width:120px; height:40px; text-align:center; line-height:40px; display:block; border-right:2px solid #ccc; background:#eee; color:#666;}

.nav ul li a:hover{ color:#f00;background: #000000;}

.nav ul li ul { position:absolute; display:none;}

.nav ul li ul li { float:none;}

.nav ul li ul li a { border-right:none; border-top:1px dotted #ccc; background:#f5f5f5;}

.nav ul li:hover ul{ display:block; }

.top{margin: 5px auto 0px auto;padding: 0px;width:980px;height:78px;text-align: left;}

.logo{margin-right: 900px;}

.banner{width: 307px;height: 61px;float:left;margin-top: -10px;}

.options{float: right;margin: -20px;}

.home,.shu,.fav{float: leftmargin: 0 16px;padding:0 0 auto auto;display: inline;padding: 0px 0px;margin-right: 20px;}

.home a,.shu a,.fav a{color: #9b9b9b;float: left;margin-left: 15px;margin-top: -10px;}
/*top*/
.content{margin: 80px 0px ; }

h1{ background:black; font-size:14px; height:35px; line-height:35px; padding-right:900px; color:white;margin-top: 80px;}

.chakan{position: relative;left: 400px;color:gray;}

.zuixin{position: relative;right:400px;}

#Methods1{ width:900px;height:110px; background:#ccc;}

#Methods1 dl{margin:0px 17px 0 17px; float:left; border:1px solid gray;}

#Methods1 dt{width:180px; margin:10px; height:90px; background:#FFF; border-bottom: 1px solid gray;}

#Methods1 dd{width:180px; margin:0 0 10px 10px; height:20px; line-height:30px; background:#FFFFFF; text-align:center;}

.td1{margin-top: 0px;}

.td2{margin-top: 0px;}

.td3{margin-top: 0px;}

.td4{margin-top: 0px;}

.tips{margin-top: 0px;margin-right: 170px;}

.tips span{color:gray;font-size: 13px;}

.tips ul{margin-right: 50px;}

hr{border:1px dashed gray;}

/*nav*/
</style>

</head>
  <body>
   <%@ include file="dengluPublic.jsp" %>
<%@ include file="daohangPublic.jsp"%>`
   <h1><font>作品信息</font></h1>
   <%!
   int num1;
    %>
   <font class="zuixin"><b>最新消息</b></font><font class="chakan"><a href="science.jsp?num=<%=num1%>">查看更多>>></a></font>
<div id="Methods1">
	<table width="980px" >
<tr>
	<td width="245px">
		<div class="td1">
			<dl>
		    	<dt><a href="scienceInfo.jsp"><img src="img/logo.jpg" width="180px" height="90px" /></a></dt>
		    	<dd>大学生优质资源共享平台</dd>
		    </dl>
	    </div>	    	
	</td>
	<td width="245px">
		<div class="td2"> <dl>
		    <dt><a href="#"><img src="img/science.jpg" width="180px" height="90px" /></a></dt>
		    <dd>STM32实现图像传输</dd></dl>
		</div>
	</td>
	<td width="245px">
		<div class="td3"><dl>
		    <dt><a href="#"><img src="img/hand.jpg" width="180px" height="90px" /></a></dt>
		    <dd>机械手设计</dd></dl>
		</div>
	</td>
	<td width="245px">
		<div class="td4"> <dl>
		    <dt><a href="#"><img src="img/yuntai.jpg" width="180px" height="90px" /></a></dt>
		    <dd>云台机械设计</dd></dl>
	    </div>
	</td>
</tr>
<tr>
	<td width="245px">
		<div class="td1">
			<dl>
		    	<dt><a href="#"><img src="img/robot.jpg" width="180px" height="90px" /></a></dt>
		    	<dd>六足机器人性能分析</dd>
		    </dl>
	    </div>	    	
	</td>
	<td width="245px">
		<div class="td2"> <dl>
		    <dt><a href="#"><img src="img/car.jpg" width="180px" height="90px" /></a></dt>
		    <dd>用51实现循迹小车</dd></dl>
		</div>
	</td>
	<td width="245px">
		<div class="td3"><dl>
		    <dt><a href="#"><img src="img/kaka.jpg" width="180px" height="90px" /></a></dt>
		    <dd>单单与他的机器人卡卡</dd></dl>
		</div>
	</td>
	<td width="245px">
		<div class="td4"> <dl>
		    <dt><a href="#"><img src="img/pcb.jpg" width="180px" height="90px" /></a></dt>
		    <dd>带你了解PCB板制作过程</dd></dl>
	    </div>
	</td>
</tr>
<tr>
	<td width="245px">
		<div class="td1">
			<dl>
		    	<dt><a href="#"><img src="img/aosong.jpg" width="180px" height="90px" /></a></dt>
		    	<dd>奥送机器人套件</dd>
		    </dl>
	    </div>	    	
	</td>
	<td width="245px">
		<div class="td2"> <dl>
		    <dt><a href="#"><img src="img/ceju.jpg" width="180px" height="90px" /></a></dt>
		    <dd>超声波测距模块</dd></dl>
		</div>
	</td>
	<td width="245px">
		<div class="td3"><dl>
		    <dt><a href="#"><img src="img/pai.jpg" width="180px" height="90px" /></a></dt>
		    <dd>树莓派使用教程</dd></dl>
		</div>
	</td>
	<td width="245px">
		<div class="td4"> <dl>
		    <dt><a href="#"><img src="img/andriod.jpg" width="180px" height="90px" /></a></dt>
		    <dd>移动端控制树莓派</dd></dl>
	    </div>
	</td>
</tr>
<tr>
	<td width="245px">
		<div class="td1">
			<dl>
		    	<dt><a href="#"><img src="img/server.PNG" width="180px" height="90px" /></a></dt>
		    	<dd>课程教学管理系统教师端</dd>
		    </dl>
	    </div>	    	
	</td>
	<td width="245px">
		<div class="td2"> <dl>
		    <dt><a href="#"><img src="img/client.PNG" width="180px" height="90px" /></a></dt>
		    <dd>课程教学管理系统学生端</dd></dl>
		</div>
	</td>
	<td width="245px">
		<div class="td3"><dl>
		    <dt><a href="#"><img src="img/art.jpg" width="180px" height="90px" /></a></dt>
		    <dd>AR人像成像</dd></dl>
		</div>
	</td>
	<td width="245px">
		<div class="td4"> <dl>
		    <dt><a href="#"><img src="img/3.jpg" width="180px" height="90px" /></a></dt>
		    <dd>简历动画设计</dd></dl>
	    </div>
	</td>
</tr>
<%!int i; 
		int num;
		String id;
		ResultSet rs1;
		ResultSet rs;
		int circle;
		int add;
		%>
	 <%//从数据库中得到数据放在合适的位置
		String driverClass1="com.mysql.jdbc.Driver";
	    String url1="jdbc:mysql://localhost:3306/vote?useSSL=false";
	    String user1="root";
	    String password1="womenilu2580";
	    Class.forName(driverClass1);
	    
	    //获取表中总的记录数
	    String driverClass="com.mysql.jdbc.Driver";
	    String url="jdbc:mysql://localhost:3306/vote?useSSL=false";
	    String user="root";
	    String password="womenilu2580";
	    Class.forName(driverClass);
	    
	    Connection conn=DriverManager.getConnection(url,user,password);
	    Connection conn1=DriverManager.getConnection(url1,user1,password1);
	    Statement stat=conn.createStatement();
	    Statement stat1=conn1.createStatement();	 
	    String sql1="select * from science";	 
	    String sql="select count(*) as a from science";	
	    rs=stat.executeQuery(sql);  
	    rs1=stat1.executeQuery(sql1);
	     while(rs.next()){//得到总的记录数
	   		num=rs.getInt("a");
		  	System.out.println("num的值："+num);
		  	
	   	%>
	   	<%
	   		if(num<4)
	   		{	
	   			System.out.println("num<4");
	   			%>
	   			<tr>
	   			<%
	   			
	   			 while(rs1.next()&&i<add){
	    				String message_title=rs1.getString("message");
	    				String time=rs1.getString("time");
	    				String img=rs1.getString("img");
	    				String publisher=rs1.getString("publisher");
	    				id=rs1.getString("id");
	    				i++;
	    				System.out.println("后:"+i);
	    				%>
	    <td width="245px">
		<div class="td1">
			<dl>
		   	<dt><a href="scienceNews.jsp?id=<%=id %>"><img src="<%=img%>" width="180px" height="90px" /></a></dt>
		    <dd><a href="scienceNews.jsp?id=<%=id %>"><%=message_title%></a></dd>
		    </dl>
	    </div>	    	
	</td>
	    		<%	    		
	    			}	    		   	    		
				%>
		
</tr>
	   	<%	}
	   		else{
	   			circle=num/4;	   			
	   			add=num%4;
	   			System.out.println(circle+","+add);
	   			%>
	   			<%
	    			for(int j=0;j<circle;j++){
	    			i=0;
	    		 %>
	   		<tr>
	   		<%	while(rs1.next()&&i<4){//得到游标指向的哪一行的记录的数据	   			
	   					String message_title=rs1.getString("message");
	    				String time=rs1.getString("time");
	    				String img=rs1.getString("img");
	    				String publisher=rs1.getString("publisher");
	    				id=rs1.getString("id");
	    				i++;
	    				System.out.println("前:"+i);
	    %>
	  
	<td width="245px">
		<div class="td4"> <dl>
		    <dt><a href="scienceNews.jsp?id=<%=id %>"><img src="<%=img%>" width="180px" height="90px" /></a></dt>
		    <dd><a href="scienceNews.jsp?id=<%=id %>"><%=message_title%></a></dd></dl>
		</div>
	</td>
	 <%}
	 rs1.previous();
	    		}
	    		%>
	</tr>
	    		
	    		<tr>
	    		<%
	    		i=0;	    		
	    		while(rs1.next()&&i<add){
	    				String message_title=rs1.getString("message");
	    				String time=rs1.getString("time");
	    				String img=rs1.getString("img");
	    				String publisher=rs1.getString("publisher");
	    				id=rs1.getString("id");
	    				i++;
	    				System.out.println("后:"+i);
	    				%>
	    <td width="245px">
		<div class="td1">
			<dl>
		    	<dt><a href="scienceNews.jsp?id=<%=id %>"><img src="<%=img%>" width="180px" height="90px" /></a></dt>
		    <dd><a href="scienceNews.jsp?id=<%=id %>"><%=message_title%></a></dd></dl>
		    </dl>
	    </div>	    	
	</td>
	    		<%	    		
	    		}
	    		}    	    		
	    	}
	    	conn1.close();
	    			conn.close();
	    System.out.print("好了");		
		%>
		
</tr>
</table>
<hr/>
本站由Dany团队搭建，欢迎有兴趣的朋友加入我们，一起建造更优质的平台
<br/>
作者联系方式：1029046433(qq)
</div>
  </body>
</html>
